package IO流;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

public class Test {
    public static void main(String[] args) {

        FileInputStream file=null;
        try {
          file= new FileInputStream("E:\\a.txt");
          int s1=file.read();
          int s2=file.read();
          int s3=file.read();
          int s4=file.read();
          System.out.println(s1);//打印输入字符a对应的ASCII码值
          System.out.println(s2);//打印输入字符b对应的ASCII码值
          System.out.println(s3);//打印输入字符c对应的ASCII码值
          System.out.println(s4);//由于文件读取完毕，返回值为-1
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (file!=null){
                try {
                    file.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
